﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Flashado.Framework;

namespace Dropthings.Widget.Widgets.ComWeather
{
	public class CityXmlInfo
	{
		public const string __City = "city";
		public const string __Name = "name";
		public const string __Code = "code";
		
		public string Name{get;set;}
		public string Code { get; set; }
		
		public XmlNode ToXmlNode(XmlDocument document)
		{
			var node = XmlHelper.CreateXmlNode(document, __City);
			XmlHelper.SetAttributeValue(node, __Name, this.Name);
			XmlHelper.SetAttributeValue(node, __Code, this.Code);
			return node;
		}
		public void Read(XmlNode node)
		{
			this.Name = XmlHelper.GetAttributeValue<string>(node, __Name, string.Empty);
			this.Code = XmlHelper.GetAttributeValue<string>(node, __Code, string.Empty);
		}
	}
}
